package com.cw1.protoType;

/**
 * @Author qiuMi
 * @description 克隆羊 - 测试
 * @Date 2022-10-07 21:12
 **/
public class SheepTest {
    public static void main(String[] args) {
        // 传统方法实现
        Sheep sheep = new Sheep("tom", 1, "白色");

        Sheep sheep2 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
        Sheep sheep3 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
        Sheep sheep4 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
        Sheep sheep5 = new Sheep(sheep.getName(), sheep.getAge(), sheep.getColor());
        //....

        System.out.println(sheep);
        System.out.println(sheep2);
        System.out.println(sheep3);
        System.out.println(sheep4);
        System.out.println(sheep5);
        //...


        // 克隆方法实现
        Sheep clone = (Sheep) sheep.clone();
        System.out.println("clone" + clone);

    }
}
